package com.kavysoft.cliente;

import com.kavysoft.prueba.MainActivity;

public class ClientMSG {

    ComClient cc;
    MainActivity c;

    //For Bidirectional Communication mode
    public ClientMSG(String ip, int port, MainActivity c) {
            //Only available on the JAVA-ANDROID project
        cc = new WSClient(ip, port, this);

        this.c = c; //To call the methods of the the upper level class	
    }

    public void onMessage(String message) {

        String[] values = message.split("\\s+"); //splitter with the " " separator

		//int ClientID = Integer.valueOf(values[0]); //Check of the ID (not required)			
        //Calls to the upper level class methods
        
    }

    public boolean sendMessage(String message) {
        if (cc != null && cc.isConnected()) {
            //Only send message
            return (cc.sendMsg(message));
        } else {
            return false;
        }
    }

    public int getId() {
        return (cc.getId());
    }

	//get name from client class
	//one method for each messages / actions that the client can do
    public void close() {
        cc.close();
    }
}
